<?php
/** .-------------------------------------------------------------------
 * |  Software: [HDPHP framework]
 * |      Site: www.hdphp.com  www.hdcms.com
 * |-------------------------------------------------------------------
 * |    Author: 向军 <2300071698@qq.com>
 * |    WeChat: aihoudun
 * | Copyright (c) 2012-2019, www.houdunwang.com. All Rights Reserved.
 * '-------------------------------------------------------------------*/

namespace app\admin\controller;

use houdunwang\db\Db;
use system\model\Admin;

class Login
{
    public function index()
    {
	//	连接数据库
		//$res=Db::table('weixincms')->get();
		//return p($res);
		//$res = (new Admin())->login();
		//测试通过模型操作数据
//		$res=(new Admin())->login();
//		return p($res);
		if($_POST)
		{
			$res=(new Admin())->login();
			//return p($res['valid']);
			if($res['valid'])
			{
				//return p(Session::get('admin.admin_id'));
				message( $res['msg'], u('admin.entry.index'), $type = 'success', $timeout = 2 );
			}else{
				//执行失败
				message($res['msg'],'back','error');
			}
		}
		return View::make();

    }
    public function code(){
		Code::num(1)->width(100)->height(50)->make();
	}
}